import { PetSpecialSkillBaseItem } from "./PetSpecialSkillBaseItem";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { TSkill } from "../../../../../Message/Db/Tables/TSkill";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class CurUsePetSpecialSkillItem
    
    export  class CurUsePetSpecialSkillItem /* flash.display.Sprite */
    {
        constructor(arg1: int)
        {
            
            this.init();
            this._skillIndex = arg1;
            return;
        }

        /* internal  */init(): void
        {
            this._baseItem = new PetSpecialSkillBaseItem();
            ObjCreate.setObjAttri(this._baseItem, 10, 15, 32, 32, this);
            this._name = ObjCreate.createGTextField("", 60, 9, 120, 20, this);
            this._lv = ObjCreate.createGTextField("", 60, 35, 80, 20, this);
            this._changeSkillTxt = ObjCreate.createGTextField(Language.getString(28088), 115, 34, 55, 20, this, null, true);
            this._changeSkillTxt.addEventListener(flash.events.TextEvent.LINK, this.onChangeSkillTxtLinkHandler);
            return;
        }

        /* internal  */onChangeSkillTxtLinkHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetSpecialSkillChangeViewShow, this._skillIndex));
            return;
        }

        public set skill(arg1: TSkill)
        {
            this._baseItem.skill = arg1;
            if (arg1) 
            {
                this.addChild(this._baseItem);
                this._name.htmlText = "<font color=\'#F5FF00\'size=\'14\'><b>" + arg1.skillName + "</b></font>";
                this._lv.htmlText = HTMLUtil.addColor("Lv." + arg1.skillLevel, "#a768c6");
                this._changeSkillTxt.htmlText = Language.getString(28088);
            }
            else 
            {
                DisplayUtil.removeMe(this._baseItem);
                this._name.text = "";
                this._lv.text = "";
                this._changeSkillTxt.text = "";
            }
            return;
        }

        /* internal */ /* var */_baseItem: PetSpecialSkillBaseItem;

        /* internal */ /* var */_name: GTextFiled;

        /* internal */ /* var */_lv: GTextFiled;

        /* internal */ /* var */_changeSkillTxt: GTextFiled;

        /* internal */ /* var */_skillIndex: int;
    }
